<?php

namespace App\Services\Admin;

use App\Models\Category;
use App\Models\Property;

class AlbumService
{
    /**
     * 获取楼盘相册分类
     */
    public function getAlbumCategory()
    {
        return Category::where('parent_id',7)->orderBy('sort','desc')->get();
    }

    public function getAlbumPropertyById($id)
    {
        return Property::findOrFail($id);
    }

    public function getSearchProperty($name)
    {
        $property = Property::where('status','T')->where('title','like','%'.$name.'%')->get();
        return response()->json([
            'error' => 0,
            'data' => $property
        ]);
    }

}